From 19bcdafa04da3705153c79f2cb916ca20cdec602 Mon Sep 17 00:00:00 2001 From: parkrrrr Date: Fri, 7 Apr 2006 14:40:56 +0000 Subject: [PATCH] Moved course calculation to grtcirc so I could use it with trackfilter --- gpsbabel/garmin_txt.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/gpsbabel/garmin_txt.c b/gpsbabel/garmin_txt.c index b6b19fb9e..15f55a311 100644 --- a/gpsbabel/garmin_txt.c +++ b/gpsbabel/garmin_txt.c @@ -289,21 +289,10 @@ distance(double lat1, double lon1, double lat2, double lon2) /* nearly MapSource return r2d(gcdist(d2r(lat1), d2r(lon1), d2r(lat2), d2r(lon2))) * 111.32 * 1000.0; } -static double -course_rad(double lat1, double lon1, double lat2, double lon2) -{ - double v1, v2; - v1 = sin(lon1 - lon2) * cos(lat2); - v2 = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(lon1 - lon2); - if (fabs(v2) < 0.000000000000001) v2 = 0.0; /* fix calculation diff. between 32- and 64-bit systems */ - if (fabs(v1) < 0.000000000000001) v1 = 0.0; /* fix calculation diff. between 32- and 64-bit systems */ - return atan2(v1, v2); -} - static double course_deg(double lat1, double lon1, double lat2, double lon2) { - return r2d(course_rad(d2r(lat1), d2r(lon1), d2r(lat2), d2r(lon2))); + return r2d(heading(d2r(lat1), d2r(lon1), d2r(lat2), d2r(lon2))); } static double -- 2.30.2